home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: nntp.coast.net!torn!news!apollo!saed
- From: saed@engn.uwindsor.ca (Saed Aryan,13325,1100,g)
- Subject: Dynamic Linking with g++ on SUN
- X-Nntp-Posting-Host: apollo.engn.uwindsor.ca
- Message-ID: <DoLAuo.D44@news.uwindsor.ca>
- Keywords: dynamic linking, g++, sun
- Sender: news@news.uwindsor.ca (Usenet)
- Reply-To: saed@engn.uwindsor.ca
- Organization: VLSI Research Group - University of Windsor
- Date: Wed, 20 Mar 1996 23:35:12 GMT
-
- Hi All,
-
- ---How do I tell the g++ linker that my libraries are shared objects?
-
-
- 1. I compile the library files as follows: g++ -c mylib.C
- 2. Then I want to create the shared object by: g++ -G -o libmylib.so mylib.o
- But -G is not supported by g++ anymore,
- it must be -shared so: g++ -shared -o libmylib.so mylib.o
- 3. But now when compiling a C++ program 'useMylib.C' and including the library
- as in: g++ -L. useMylib.C -lmylib
- I get an error: ld: -lmylib: No such file or directory
- 4. And when I rename libmylib.so to libmylib.a (which doesn't make sense but I
- had to do something) I get the error:
- collect2: dynamic dependency libmylib.so.0.0 not found
-
- I would appreciate it if someone could give me the correct recipe for compiling
- an s.o. library, and including it when compiling the actual C++ program.
-
- I am using GNU C++ g++ 2.7.0 on SUN OS 4.1.3
-
- The GNU C++ FAQ doesnt' help me, neither does the man page. I am also looking for
- those famous 'manuals in the distribution' but can't find them. A related question
- about the manual has been posted to the gnu g++ newsgroup.
-
- Thanks a lot in advance,
-
- Aryan.
-
-
-
-
-
-
-
-